<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
    <html>
        <head>
        <title></title>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <script src="__PUBLIC__/jquery-1.7.2.min.js"></script>
        <css file='__PUBLIC__/Uploadify/uploadify.css'/>
        <script src="__PUBLIC__/uploadify/jquery.uploadify-3.1.min.js"></script>
        <link href="__PUBLIC__/admin/css/category.css" rel="stylesheet" type="text/css"/>
       
        <script>
            var attrurl="{:U('getAttr')}";
            var ROOT='__ROOT__';
             $(function() {
                $("#upload").uploadify({
                    height        : 30,
                    swf           : '__PUBLIC__/Uploadify/uploadify.swf',
                    uploader      : '{:U("Common/up")}',
                    formData : { 'session_id' : '<?php echo session_id();?>' },
                    width         : 120,
                    onUploadSuccess:function(file, data, response){
                        eval("var data = " + data);
         		if (data.status) {
         			var path = '__ROOT__/Uploads/List/' + data.path;
         			$('.showpic img').attr('src', path).show();
         			$('input[name="pic"]').val(data.path);
         		}
                    }
                });
                $("#uploads").uploadify({
                    height        : 30,
                    swf           : '__PUBLIC__/Uploadify/uploadify.swf',
                    uploader      : '{:U("Common/uploads")}',
                    formData : { 'session_id' : '<?php echo session_id();?>' },
                    width         : 120,
                    onUploadSuccess:function(file, data, response){
                        eval("var data = " + data);
                        if (data.status) {
                            
                                var img = '<img src="' + ROOT + '/Uploads/detail/' + data.path.medium + '" width="130" height="80"/>';
                                alert(img);
                                $('.showpics').append(img);
                                
                                var input = '<input type="hidden" name="max[]" value="' + data.path.max + '"/>';
                                input += '<input type="hidden" name="medium[]" value="' + data.path.medium + '"/>';
                                input += '<input type="hidden" name="mini[]" value="' + data.path.mini + '"/>';
                                $('#pics').append(input);
                        } else {
                                alert(data.msg);
                        }
                    }
                });

            });
        </script>
        <script src="__PUBLIC__/admin/js/goods.js"></script>
        
        <style>
            table th{width:20%;}
            table td{width:50%;}
            #attr,#spec{display: none;}
            .content table thead tr th{height: 15px;padding:0;}
            .content table thead tr{margin-bottom: 5px;}
            .delSpec,.addSpec{cursor: pointer;}
        </style>
    </head>
    <body>

        <div class='content'>
            <div class='t'>
                <h3>添加商品</h3>
            </div>
            <form action="{:U('add')}" method="post" enctype='multipart/form-data'>
                <table>

                    <tr>
                        <th width="10%">商品分类</th>
                        <td width="50%">
                            <select name="cid">
                                <option>--商品分类--</option>
                                <foreach name='cate' item="c">
                                    <option value="{$c.cid}" pid="{$c.pid}" type_id="{$c.type_id}">{$c.html}{$c.name}</option>
                                </foreach>
                            </select><span class='msgc'></span>
                        </td>
                    </tr>
                    
                    <tr>
                        <th>商品名称</th>
                        <td><input type="text" name='name'/></td>
                    </tr>
                    <tr>
                        <th>货号</th>
                        <td><input type="text" name='num'/><span>不输入，系统将生成默认编号</span></td>
                    </tr>
                    <tr>
                        <th>商城价</th>
                        <td><input type="text" name='zen_price'/></td>
                    </tr>
                    <tr>
                        <th>市场价</th>
                        <td><input type="text" name='market_price'/></td>
                    </tr>
                    <tr>
                        <th>单位</th>
                        <td><input type="text" name='unit'/></td>
                    </tr>
                    <tr>
                        <th>点击数</th>
                        <td><input type="text" name='click'/></td>
                    </tr>
                    <tr>
                        <th>商品品牌</th>
                        <td>
                                <select name="bid">
                                        <option value="">--请选择品牌--</option>
                                        <foreach name='breed' item="b">
                                           <option value="{$b.bid}">&nbsp;{$b.name}</option>
                                        </foreach>
                                       
                                </select>
                        </td>
                    </tr>

                </table>
                <table id='attr'>
                    <thead>
                        <tr>
                            <th colspan='2' class="blue" style='text-align:center;'>属性</th>
                        </tr>
                    </thead>
                    <tbody></tbody>
                </table>
                <table id='spec'>
                    <thead>
                        <tr>
                            <th colspan='2' class="blue" style='text-align:center;'>规格</th>
                        </tr>
                    </thead>
                    <tbody></tbody>
                </table>
              <table id='pic'>
                    <thead>
                        <tr>
                            <th colspan='2' class="blue" style='text-align:center;'>上传商品图片</th>
                        </tr>
                    </thead>
                    <tbody>
                    <input type="hidden" name="pic"/>
                        <tr class='showpic'>
                            <img style='display:none;'/>
                        </tr>
                        <tr>
                            <td><input type="file" name='pic' id="upload"/></td>
                        </tr>
                    </tbody>
                </table>
                <table id='pics'>
                    <thead>
                        <tr>
                            <th colspan='2' class="blue" style='text-align:center;'>上传图册</th>
                        </tr>
                    </thead>
                    <tbody>
                        
                        <tr class='showpics'>
                          
                        </tr>
                        <tr>
                            <td><input type="file" name='pic' id="uploads"/></td>
                        </tr>
                    </tbody>
                </table>
                <table id='detail'>
                    <thead>
                        <tr>
                            <th colspan='2' class="blue" style='text-align:center;'>产品简介</th>
                        </tr>
                    </thead>
                    <tbody>

                    </tbody>
                </table>
                <div>
                    <tr>
                        <td colspan="2" width="45%" align='right'><input type="submit" class="bt1" value="添 加"/></td>
                    </tr>
                </div>

            </form>
        </div>
    </body>
</html>